/*
 * @Descripttion: 区域判断
 * @version:
 * @Author: zhangfan
 * @email: 2207044692@qq.com
 * @Date: 2020-08-28 15:18:11
 * @LastEditors: younghxp
 * @LastEditTime: 2022-04-08 09:45:18
 */
import common from './common.js'
import store from '../store'
/**
 * @description: 判断区域是否是昆明
 */
const isKMUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (domain == '221.213.62.193' || domain == '10.10.12.10') {
    return true
  }
  return false
}
/**
 * @description: 判断区域是否是恩施
 */
const isEsUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (
    domain == '61.184.223.38' ||
    domain == '122.189.254.39' ||
    domain == 'labors.rsj.enshi.gov.cn' ||
    domain == 'labors.esrsj.com'
  ) {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是随州
 */
const isSzUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (domain == '221.235.153.4') {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是内蒙
 */
const isNmUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (
    domain == '117.161.29.103' ||
    domain == '117.161.29.104' ||
    domain == '58.49.98.18' ||
    domain == '192.168.9.47'
  ) {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是宜昌
 */
const isYcUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isYiChang = ''
  if (domain == '219.139.130.122') {
    isYiChang = true
    return isYiChang
  }
  return false
}

/**
 * @description: 判断区域是否是滁州
 */
const isCzUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isChuzhou = ''
  if (
    domain == 'chuzhou.sunhj.cn' ||
    domain == '223.244.255.57' ||
    domain == '223.244.227.79' ||
    domain == '192.168.9.207'
  ) {
    isChuzhou = true
    return isChuzhou
  }
  return false
}

/**
 * @description: 判断区域是否是全国演示
 */
const isYS = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (domain == 'lsp.credit100.com') {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是黄石
 */
const isHsUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (
    domain == 'localhost' ||
    domain == '119.100.56.90' ||
    domain == '192.168.9.207' ||
    domain == 'huangshi.wgtd.cn' ||
    domain == common.testIp5 ||
    domain == '192.168.9.36'
  ) {
    return true
  }
  return false
}
/**
 * @description: 判断区域是否是西双版纳
 */
const isXSBNUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (window.location.pathname == '/xsbn/') {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是长春
 */
const isCCUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isCCUser = ''
  if (domain == '10.120.9.181') {
    isCCUser = true
    return isCCUser
  }
  return false
}

/**
 * @description: 判断区域是否是九江
 */
const isJjUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isJjUser = ''
  if (window.location.pathname == '/jiujiang/') {
    isJjUser = true
    return isJjUser
  }
  return false
}

/**
 * @description: 判断区域是否是宜春
 */
const isYichunUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isYichunUser = ''
  if (window.location.pathname == '/yichun/') {
    isYichunUser = true
    return isYichunUser
  }
  return false
}

/**
 * @description: 判断区域是否是武汉
 */
const isWhUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isWhUser = ''
  if (domain == 'zhjd.rsj.wuhan.gov.cn' || domain == common.testIp2) {
    isWhUser = true
    return isWhUser
  }
  return false
}

/**
 * @description: 判断区域是否是银川
 */
const isYinChuanUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isYinChuanUser = ''
  if (domain == '111.51.70.191' || domain == '10.229.60.3') {
    isYinChuanUser = true
    return isYinChuanUser
  }
  return false
}

/**
 * @description: 判断区域是否是十堰
 */
const isShiYanUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isShiYanUser = ''
  if (domain == '61.183.19.132') {
    isShiYanUser = true
    return isShiYanUser
  }
  return false
}

/**
 * @description: 判断区域是否是鄂州
 */
const isEZhouUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var isEZhouUser = ''
  if (
    domain == '219.138.224.85' ||
    domain == 'ezhou.wgtd.cn' ||
    domain == '192.168.9.172'
  ) {
    isEZhouUser = true
    return isEZhouUser
  }
  return false
}

/**
 * @description: 判断区域是否是湖北
 */
const isHuBeiUser = function (row, column, cellValue) {
  var areaId = store.state.areaInfoArr.areaId
  if (areaId.substr(0, 2) == '42') {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是普洱
 */
const isPuErUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (domain == '39.130.160.14') {
    return true
  }
  return false
}

//判断是否能通过接口平台进入
const isDataAccess = function (row, column, cellValue) {
  var dataAccess = store.state.areaInfoArr.dataAccess
  if (dataAccess == '1') {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是夷陵区
 */
const isYiLingUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  var area = window.location.pathname
  if (
    (domain == 'yl.wgtd.cn' || domain == '219.139.130.122') &&
    area.indexOf('yl') !== -1
  ) {
    return true
  }
  return false
}

/**
 * @description: 判断区域是否是襄阳
 */
const isXiangYangUser = function (row, column, cellValue) {
  var host = window.location.host
  var domain = host.split(':')[0]
  if (
    domain == '119.36.80.41' ||
    domain == '223.75.74.32' ||
    domain == '192.168.9.47'
  ) {
    return true
  }
  return false
}
export default {
  isKMUser,
  isEsUser,
  isSzUser,
  isNmUser,
  isYcUser,
  isCzUser,
  isYS,
  isHsUser,
  isXSBNUser,
  isCCUser,
  isJjUser,
  isYichunUser,
  isWhUser,
  isYinChuanUser,
  isShiYanUser,
  isEZhouUser,
  isHuBeiUser,
  isDataAccess,
  isYiLingUser,
  isPuErUser,
  isXiangYangUser,
}
